package com.zhouchb.test.设计模式.代理模式.静态代理;

/**
 * @Create 2023-08-07 20:53
 * @Description
 */
interface Factory{
    public void proCloth();
}
//代理类
public class StaticProxy implements Factory{
    private Factory factory;
    public StaticProxy (Factory factory){
        this.factory = factory;
    }
    @Override
    public void proCloth() {
        System.out.println("我是代理前");
        factory.proCloth();
        System.out.println("我是代理后");
    }
}
//被代理类
class Nike implements Factory{

    @Override
    public void proCloth() {
        System.out.println("Nick生产衣服");
    }
}
class TestProxy{
    public static void main(String[] args) {
        Nike nike = new Nike();
        StaticProxy staticProxy = new StaticProxy(nike);
        staticProxy.proCloth();
    }
}
